<template>
  <el-select v-model="selectedValue" placeholder="请选择" class="w-100%">
    <el-option v-for="item in options" :key="item.label" :label="item.label"
      :value="{ value: item.value, label: item.label }" />
  </el-select>
</template>

<script setup lang="ts">
import { computed } from 'vue'

interface Option {
  label: string;
  value: string;
  isDefault?: boolean;
}

const props = withDefaults(
  defineProps<{
    modelValue: any
    options: Option[];
  }>(),
  {
    modelValue: {},
    options: () => [] as Option[]
  },
)
const selectedValue = computed({
  get() {
    return props.modelValue || {}
  },
  set(value) {
    emit('update:modelValue', value)
  },
})
const emit = defineEmits(['update:modelValue'])
</script>
<style scoped></style>
